package duyd.ws.training.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@SuppressWarnings("serial")
@Entity
@Table(name = "CONTACT_TEL_DETAIL")
@XmlRootElement
public class ContactTelDetail implements Serializable {

	private Long id;

	private Contact contact;

	private String telType;

	private String telNumber;

	private int version;

	@XmlElement
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "CONTACT_TEL_DETAIL_ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "CONTACT_ID")
	public Contact getContact() {
		return contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}

	@XmlElement
	@Column(name = "TEL_TYPE")
	public String getTelType() {
		return telType;
	}

	public void setTelType(String type) {
		this.telType = type;
	}

	@XmlElement
	@Column(name = "TEL_NUMBER")
	public String getTelNumber() {
		return telNumber;
	}

	public void setTelNumber(String number) {
		this.telNumber = number;
	}

	@XmlElement
	@Version
	@Column(name = "CONTACT_TEL_DETAIL_VERSION")
	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String toString() {
		return "ContactTelDetail[" + "Id: " + id + ", Tel type: " + telType
				+ ", Tel number: " + telNumber + "]";
	}

}
